package com.example.jvm.chapter03;

public class ThreadLocalExample {


    private ThreadLocal<Integer> local = new ThreadLocal<>();

    public void test() {
        local.set(1);
    }

    public static void main(String[] args) {
        new Thread(() -> {
            ThreadLocalExample example = new ThreadLocalExample();
            example.test();
            example.local = null;
            System.gc();
            Thread thread = Thread.currentThread();
            ThreadLocal<Integer> local2 = new ThreadLocal<>();
            local2.set(100001);
            System.out.println("hello world");
        }).start();
    }
}
